package tech.bmatch.photo.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;

public class FileUtils {

    /**
     * Logger
     */
    public static final Logger logger = LoggerFactory.getLogger(FileUtils.class);

    /**
     * 得到文件流
     *
     * @param filePath 文件路径
     * @return
     */
    public static byte[] getData(String filePath) {
        byte[] data = null;
        try {
            File file = new File(filePath);
            FileInputStream in = new FileInputStream(file);
            data = new byte[in.available()];
            in.read(data);
            return data;
        } catch (Exception e) {
            logger.error("读取文件错误:" + filePath);
            e.printStackTrace();
        }
        return null;
    }
}
